package com.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 访客
 *
 * @TableName guest
 */
@TableName(value = "guest")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class Guest extends CommonProperty implements Serializable {
    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 访客名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 访客手机号
     */
    @TableField(value = "phone")
    private String phone;

    /**
     * 访客身份
     */
    @TableField(value = "identity")
    private String identity;

    /**
     * 进入宿舍楼时间
     */
    @TableField(value = "enter_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime enterTime;

    /**
     * 访客进入宿舍原因
     */
    @TableField(value = "season")
    private String season;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}